package cn.skyquant.quant4j.jforex.sdk.strategy2;

import java.util.Objects;

public abstract class AbstractConfig {
    public final String name;
    public final int eaId;
    public final int index;//序列
    public final double m;//仓位倍率

    public AbstractConfig(QuantStrategy strategy, int index, double m) {
        this.name = strategy.getName();
        this.eaId = strategy.eaId;
        this.index = index;
        this.m = m;
    }

    public abstract boolean isValid();

    @Override
    public String toString() {
        return name+"_"+eaId+"_"+index;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AbstractConfig that = (AbstractConfig) o;
        return eaId == that.eaId &&
                index == that.index &&
                name.equals(that.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, eaId, index);
    }
}
